package com.xiaozeng.product.controller;

import com.xiaozeng.param.ProductSearchParam;
import com.xiaozeng.pojo.Product;
import com.xiaozeng.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: xiaozeng
 * @Date: 2022 11
 * @Description: 搜索商品控制器
 **/
@RestController
@RequestMapping("product")
public class ProductSearchController {
    @Autowired
    private ProductService productService;
    /**
     * 查询全部商品信息,供search服务更新
     */
    @GetMapping("list")
    public List<Product> list(){

        return productService.list();
    }

    /**
     * 调用search服务，查询商品信息
     */
    @PostMapping("search")
    public Object search(@RequestBody ProductSearchParam productSearchParam){

        return productService.search(productSearchParam);
    }

}
